package com.wdl.fmnew.app.fragmentDemo.demo01;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.wdl.fmnew.R;
import com.wdl.fmnew.core.base.BaseFragment;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by wdl on 2017/9/19.
 */

public class Demo01Fragment extends BaseFragment implements Demo01Contract.View {
    @BindView(R.id.showData)
    TextView tv_show;

    @Inject
    Demo01Presenter demo01Presenter;



    @Inject
    public Demo01Fragment() {

    }

    @Override
    public View getView(LayoutInflater inflater, @Nullable ViewGroup container) {
        View inflate = inflater.inflate(R.layout.fragment_demo1, container, false);
        return inflate;
    }

    @OnClick(R.id.click_test)
    public void test() {
        Toast.makeText(getActivity(),"click",Toast.LENGTH_SHORT).show();
        demo01Presenter.testData();
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        demo01Presenter.takeView(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        demo01Presenter.dropView();
    }

    @Override
    public void showData(String data) {
        tv_show.setText(data);
    }
}
